js preventdefault

54

js preventdefault -

function(event) {
  event.preventDefault();
}

javascript allow default -

 $('form').submit( function(ev){

         ev.preventDefault();

         //later you decide you want to submit
         $(this).unbind('submit').submit()

  });

preventdefault javascript -

document.querySelector("#id-checkbox").addEventListener("click", function(event) {
         document.getElementById("output-box").innerHTML += "Sorry! <code>preventDefault()</code> won't let you check this!<br>";
         event.preventDefault();
}, false);

Comments

Submit
0 Comments